%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/functions/computed-column-user"
    Bucket0("Bucket 0 (root)<br /><br />1: PgSelectInlineApply[26]<br />ᐳ: 8, 9, 25, 30, 10<br />2: PgSelect[7]<br />ᐳ: Access[27]<br />3: PgSelectRows[12]<br />ᐳ: First[11], PgSelectSingle[13]"):::bucket
    Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 27, 13<br /><br />ROOT PgSelectSingleᐸforumsᐳ[13]<br />1: <br />ᐳ: List[28], Lambda[29]<br />2: PgSelectRows[21]<br />ᐳ: First[20], PgSelectSingle[22]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 22<br /><br />ROOT PgSelectSingle{1}ᐸusersᐳ[22]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2

    %% plan dependencies
    PgSelect7[["PgSelect[7∈0] ➊<br />ᐸforumsᐳ<br />More deps:<br />- Constantᐸ'f1700000-0000-0000-0000-000000000f17'ᐳ[30]"]]:::plan
    Object10{{"Object[10∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    PgFromExpression25{{"PgFromExpression[25∈0] ➊"}}:::plan
    PgSelectInlineApply26["PgSelectInlineApply[26∈0] ➊"]:::plan
    Object10 & PgFromExpression25 & PgSelectInlineApply26 --> PgSelect7
    Access8{{"Access[8∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access8 & Access9 --> Object10
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access8
    __Value2 --> Access9
    First11{{"First[11∈0] ➊"}}:::plan
    PgSelectRows12[["PgSelectRows[12∈0] ➊"]]:::plan
    PgSelectRows12 --> First11
    PgSelect7 --> PgSelectRows12
    PgSelectSingle13{{"PgSelectSingle[13∈0] ➊<br />ᐸforumsᐳ"}}:::plan
    First11 --> PgSelectSingle13
    Access27{{"Access[27∈0] ➊<br />ᐸ7.m.joinDetailsFor15ᐳ"}}:::plan
    PgSelect7 --> Access27
    List28{{"List[28∈1] ➊<br />ᐸ27,13ᐳ"}}:::plan
    Access27 & PgSelectSingle13 --> List28
    First20{{"First[20∈1] ➊"}}:::plan
    PgSelectRows21[["PgSelectRows[21∈1] ➊"]]:::plan
    PgSelectRows21 --> First20
    Lambda29{{"Lambda[29∈1] ➊<br />ᐸpgInlineViaJoinTransformᐳ"}}:::plan
    Lambda29 --> PgSelectRows21
    PgSelectSingle22{{"PgSelectSingle[22∈1] ➊<br />ᐸusersᐳ"}}:::plan
    First20 --> PgSelectSingle22
    List28 --> Lambda29
    PgClassExpression23{{"PgClassExpression[23∈2] ➊<br />ᐸ__forums_r...”username”ᐳ"}}:::plan
    PgSelectSingle22 --> PgClassExpression23
    PgClassExpression24{{"PgClassExpression[24∈2] ➊<br />ᐸ__forums_r...vatar_url”ᐳ"}}:::plan
    PgClassExpression23 o--o PgClassExpression24

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect7,Access8,Access9,Object10,First11,PgSelectRows12,PgSelectSingle13,PgFromExpression25,PgSelectInlineApply26,Access27 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,First20,PgSelectRows21,PgSelectSingle22,List28,Lambda29 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression23,PgClassExpression24 bucket2

